package cn.ac.jaas.ljx.spring.beanscope;

import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class Main {

	public static void main(String[] args) {
		AnnotationConfigApplicationContext context =
				new AnnotationConfigApplicationContext(ScopeConfig.class);
		DemoSingletonService singletonService1 =
				context.getBean(DemoSingletonService.class);
		DemoSingletonService singletonService2 =
				context.getBean(DemoSingletonService.class);
		DemoPrototypeService prototypeService1 =
				context.getBean(DemoPrototypeService.class);
		DemoPrototypeService prototypeService2 =
				context.getBean(DemoPrototypeService.class);
		
		System.out.println("singletonService1 == SingletonService2 : "
				+ singletonService1.equals(singletonService2));
		System.out.println("prototypeService1 == prototypeService2 : "
				+ prototypeService1.equals(prototypeService2));
		context.close();
	}
}
